<template>
  <div class="toast" v-show="isShow">
    <div class="content">
      {{ message }}
    </div>
  </div>
</template>

<script>
export default {
  name: "Toast",
  data() {
    return {
      message: '默认内容',
      isShow: false,
    }
  },
  methods: {
    show(content) {
      this.isShow = true;
      this.message = content;
    },
    hide() {
      this.isShow = false;
    }
  }
}
</script>

<style scoped>
.toast {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 10px;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.2);
  color: #fff;
  border-radius: 5px;
}
</style>